<?php

require_once("getRemoteImage.php");
class Util
{

	public static function getimgs($html)
	{
		if (preg_match_all('~<img[\s\S]*?\ssrc=([\""\'])([^\""\']+?)\1.*?>~i', $html, $imgs)) {
				$urlpath ="/upload/images/";
				$config = array(
					"urlpath"=>$urlpath,
					"savePath" => dirname(__DIR__).'/www/'.$urlpath ,            //保存路径
					"allowFiles" => array( ".gif" , ".png" , ".jpg" , ".jpeg" , ".bmp" ) , //文件允许格式
					"maxSize" => 3000                    //文件大小限制，单位KB
				);
		 	return getRemoteImage($imgs[2],$config);
		}
		return array();
	}
}